<template>
  <div class="publicMoney">
    <span v-if="showMoney">
      {{ integer }}{{ decimal ? '.' : '' }}
      <span class="decimal">{{ decimal }}</span>
    </span>
    <span v-else>******</span>
  </div>
</template>

<script>
  export default {
    name: 'PublicMoney',
    props: {
      money: {
        // eslint-disable-next-line vue/require-prop-type-constructor
        type: String | Number,
        default: '',
      },
      showMoney: {
        type: Boolean,
        default: false,
      },
    },
    data() {
      return {
        str: '',
        integer: '',
        decimal: '',
      }
    },
    watch: {
      money() {
        let arr = (this.money + '').split('.')
        this.integer = arr[0]
        if (arr.length === 2) this.decimal = arr[1]
      },
    },
    created() {},
  }
</script>

<style scoped lang="less">
  .publicMoney {
    font-size: 33px;
    color: #ffffff;
    .decimal {
      font-size: 20px;
    }
  }
</style>
